package com.hotel.controller;

import com.hotel.pojo.Worker;
import com.hotel.pojo.WorkerSalaries;
import com.hotel.service.WorkerSalariesService;
import com.hotel.vo.PageResult;
import com.hotel.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 实现对WorkerSalaries的操作
 * @author by LuJinRong
 * @date 2021/7/24。
 * @time 11:33。
 */
@RestController
@RequestMapping("/workerSalaries")
@CrossOrigin
public class WorkerSalariesController {

    @Autowired
    private WorkerSalariesService workerSalariesService;
    /*实现查询*/
    @GetMapping("/findAll")
    public SysResult findAll(PageResult pageResult){
        System.out.println("wwwwwwwwwwwwwwwwww");
        return SysResult.success(workerSalariesService.findAll(pageResult));
    }
    @DeleteMapping("/{id}")
    public SysResult deleteWorkerSalaries(@PathVariable Integer id){
        workerSalariesService.deleteWorkerSalaries(id);
        return SysResult.success();
    }
    @GetMapping("/{id}")
    public SysResult getUserById(@PathVariable Integer id){
        WorkerSalaries worker =  workerSalariesService.getUserById(id);
        return SysResult.success(worker);
    }
    @PostMapping("/UserSalaries")
    public SysResult UserSalaries(@RequestBody WorkerSalaries workerSalaries){
        workerSalariesService.addUser(workerSalaries);
        System.out.println("fgsdg,d");
        return SysResult.success();
    }
}
